﻿<%@ Page Title="" Language="C#" MasterPageFile="~/manager/page/ManagerMasterPage.Master" AutoEventWireup="true" CodeBehind="eventstat.aspx.cs" Inherits="Com.Web.coffinegurunaru.manager.Event.eventstat" %>
<%@ Register TagPrefix="UC" TagName="Menu" Src="~/manager/event/menu.ascx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="phHead" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="phContent" runat="server">



<hr />
<br />
<table width="100%">
<tr>
	<td valign="top" width="100">
		<UC:Menu ID="Menu1" SubPageType=2 runat="server" />
	</td>
	<td style="width:20px;"></td>
	<td>

<table>
<tr>
	<td>
		<select id="m_SearchType">
			<option value="0">전체</option>
			<option value="1">진행중</option>
		</select>
	</td>
</tr>
<tr>
	<td style="text-align:center;" valign="top">
		<div id="m_List"></div><br />
		<div id="m_Pager"></div>
	</td>
	<td style="width:20px;">&nbsp;</td>
	<td valign="top" ><div id="m_Viewer"></div>
	<div><input type="button" value="이벤트참여자" id="m_btnEvent"/><input type="button" value="댓글관리"  id="m_btnComment"/></div>
	<div id="m_EventUserList" style="display:none;">
		<div id="m_UserList"></div>
		<div id="m_UserPager" style="text-align:center;"></div>
	</div>
	<div id="m_EventCommentList" style="display:none;">
		<div id="m_CommentList"></div>
		<div id="m_CommentPager" style="text-align:center;"></div>
	</div>
	</td>
</tr>
</table>


<script language="javascript" type="text/javascript">
(function($) {
	$.CoffineEvent = {};
	
	$.CoffineEvent = {
		EventSN : 0,
		Init : function() {
			$("#m_btnEvent").hide();
			$("#m_btnComment").hide();
			$("#m_SearchType").change(function() {
				$.CoffineEvent.GetList();
			});
			
			$("#m_Pager").pager({
				pageSize : 5,
				useCallback : true,
				pageNo : 1,
				callback:function(pageNo) {
					$.CoffineEvent.GetList();
				}
			});
			
			$("#m_UserPager").pager({
				pageSize : 10,
				useCallback : true,
				pageNo : 1,
				callback:function(pageNo) {
					$.CoffineEvent.WriterGetList();
				}
			});
			
			$("#m_CommentPager").pager({
				pageSize : 10,
				useCallback : true,
				pageNo : 1,
				callback:function(pageNo) {
					$.CoffineEvent.CommentGetList();
				}
			});
			
			$("#m_btnEvent").click(function() {
				$("#m_EventUserList").show();
				$("#m_EventCommentList").hide();
				$("#m_UserPager").pager("option", "currentPageNo", 1);
				$.CoffineEvent.WriterGetList();
			});
			$("#m_btnComment").click(function() {
				$("#m_EventCommentList").show();
				$("#m_EventUserList").hide();
				$("#m_CommentPager").pager("option", "currentPageNo", 1);
				$.CoffineEvent.CommentGetList();
			});

			$.CoffineEvent.GetList();
		},

		
		GetList : function() {
			var SearchType = $("#m_SearchType").val();
			$("#m_List").ajaxNet(
			"/manager/Event/eventMethod.aspx?_vb=GetList",
			{
				"SearchType" : SearchType
			,	"PageNo" : $("#m_Pager").pager("option", "currentPageNo")
			,	"PageSize" : $("#m_Pager").pager("option", "pageSize")
			}, function(results, context)
			{
				$("#m_List").html( results[0] );
				$("#m_Pager").pager("update", results[1]);
				$("#m_List").find("input.m_btnViewer").click(function() {
					var $tr = $(this).closest("tr");
					var data = $tr.tagdata();
					$.CoffineEvent.GetInfo(data.EventSN);
				});
			});
		},
		
		GetInfo : function( EventSN ) {
			$.CoffineEvent.EventSN = EventSN;
			$("#m_btnEvent").show();
			$("#m_btnComment").show();
			$("#m_List").ajaxNet(
			"/manager/Event/eventMethod.aspx?_vb=GetStateInfo",
			{
				"EventSN" : EventSN
			}, function(results, context)
			{
				$("#m_Viewer").html( results );
				$("#m_btnEvent").click();
			});
		},
		
		WriterGetList : function() {
			$("#m_List").ajaxNet(
			"/manager/Event/eventMethod.aspx?_vb=UserList",
			{
				"EventSN" : $.CoffineEvent.EventSN
			,	"PageNo" : $("#m_UserPager").pager("option", "currentPageNo")
			,	"PageSize" : $("#m_UserPager").pager("option", "pageSize")
			}, function(results, context)
			{
				$("#m_UserList").html( results[0] );
				$("#m_UserPager").pager("update", results[1]);
			});
		},
		
		CommentGetList : function() {
			$("#m_List").ajaxNet(
			"/manager/Event/eventMethod.aspx?_vb=CommentGetList",
			{
				"EventSN" : $.CoffineEvent.EventSN
			,	"PageNo" : $("#m_CommentPager").pager("option", "currentPageNo")
			,	"PageSize" : $("#m_CommentPager").pager("option", "pageSize")
			}, function(results, context)
			{
				$("#m_CommentList").html( results[0] );
				$("#m_CommentPager").pager("update", results[1]);
				
				$("#m_CommentList input.m_CommentRemove").click(function() {
					var $tr = $(this).closest("tr");
					var data = $tr.tagdata();
					$.CoffineEvent.CommentRemove(data.EventCommentSN);
				});
			});
		},
		
		CommentRemove : function( EventCommentSN ) {
			if ( confirm("정말로 삭제하시겠습니까?") ) {
				$("#m_List").ajaxNet(
				"/manager/Event/eventMethod.aspx?_vb=CommentRemove",
				{
					"EventCommentSN" : EventCommentSN
				}, function(results, context)
				{
					$.CoffineEvent.CommentGetList();
				});
			}
		}
	}
	
	$(function() {
		$.CoffineEvent.Init();
	});
})(jQuery);
</script>














	</td>
</tr>
</table>




</asp:Content>
